// class

// ES5
function Point(x, y) {
    this.x = x;
    this.y = y;
  }
  
Point.prototype.toString = function () {
return '(' + this.x + ', ' + this.y + ')';
};

var p = new Point(1, 2);

  //定义类
class Point {
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }

    toString() {
        return '(' + this.x + ', ' + this.y + ')';
    }
  }
var p = new Point(1, 2);


// Class 表达式
// 与函数一样，类也可以使用表达式的形式定义

const MyClass = class Me {
    getClassName() {
      return Me.name;
    }
  };


  let inst = new MyClass();
inst.getClassName() // Me
Me.name // ReferenceError: Me is not defined

